package com.woniuxy.joylife.manager.controller;

import com.woniuxy.joylife.manager.entity.OwnerUserEntity;
import com.woniuxy.joylife.manager.service.OwnerUserService;
import com.woniuxy.joylife.manager.utils.PageUtils;
import com.woniuxy.joylife.manager.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 业主账号信息
 *
 * @author renxiang
 * @email 981405195@qq.com
 * @date 2020-05-14 10:57:33
 */
@RestController
@RequestMapping("manager/owneruser")
public class OwnerUserController {
    @Autowired
    private OwnerUserService ownerUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("manager:owneruser:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = ownerUserService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("manager:owneruser:info")
    public R info(@PathVariable("id") String id){
		OwnerUserEntity ownerUser = ownerUserService.getById(id);

        return R.ok().put("ownerUser", ownerUser);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("manager:owneruser:save")
    public R save(@RequestBody OwnerUserEntity ownerUser){
		ownerUserService.save(ownerUser);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("manager:owneruser:update")
    public R update(@RequestBody OwnerUserEntity ownerUser){
		ownerUserService.updateById(ownerUser);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("manager:owneruser:delete")
    public R delete(@RequestBody String[] ids){
		ownerUserService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
